//引入路由组件
import Home from "@/pages/home/Home";
import Login from "@/pages/login/Login";
import Search from "@/pages/search/Search";
import Register from "@/pages/register/Register";
import Detail from "@/pages/detail/Detail";
import AddCartSuccess from "@/pages/shopcart/AddCartSuccess";
import ShopCart from "@/pages/shopcart/ShopCart";

export default [
    // 重定向：当项目跑起来时，立马重定向到首页
    {
        path: "*",
        component: Home,
        //配置路由元信息，可以添加自定义数据
        meta: { isShow: true },
    },
    {
        path: "/home",
        component: Home,
        meta: { isShow: true },
    },
    {
        path: "/login",
        component: Login,
        meta: { isShow: false },
    },
    {
        // 给路由命名
        name: "search",
        //使用 params 的方式，需要提前声明接收参数，写好占位符
        path: "/search/:keyword?",
        component: Search,
        meta: { isShow: true },
    },
    {
        path: "/register",
        component: Register,
        meta: { isShow: false },
    },
    {
        path: "/detail/:skuId",
        component: Detail,
        meta: { isShow: true },
    },
    {
        //给路由命名
        name: "addCartSuccess",
        path: "/addCartSuccess",
        component: AddCartSuccess,
        meta: { isShow: true },
    },
    {
        name: "shopCart",
        path: "/shopCart",
        component: ShopCart,
        meta: { isShow: true },
    },
]